﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace DigitalQuran.Threading {

    /// <summary>
    /// Represent Queue of Background Operations
    /// </summary>
    public class BackgroundOperationsQueue : Queue<BackgroundOperation> {

        static object lockObj = new object();

        public new void Enqueue(BackgroundOperation operation) {
            lock (lockObj) {
                base.Enqueue(operation);
            }            
        }

        public new BackgroundOperation Dequeue() {
            lock (lockObj) {
                return base.Dequeue();
            }
        }

        public new void Clear() {
            lock (lockObj) {
                base.Clear();
            }
        }

        public bool HasItems {
            get { return this.Count > 0; }
        }
    }
}